﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NetGather.aspx.cs" Inherits="Cms.Web.CmsSystem.SysAdmin.INFO.NetGather" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>数据采集页面</title>
    <script src="/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="/Scripts/jqGrid/lan/grid.locale-cn.js" type="text/javascript"></script>
    <script src="/Scripts/jqGrid/jquery.jqGrid.min.js" type="text/javascript"></script>
    <link href="/App_Themes/Default/jqueryui/jquery-ui-1.7.1.custom.css" rel="stylesheet"
        type="text/css" />
    <link href="/App_Themes/Default/ui.jqgrid.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var jgGridjsonReader = { root: "rows", page: "page", total: "total", records: "records", repeatitems: false, cell: "cell", id: "Id", userdata: "userdata", subgrid: { root: "rows", repeatitems: true, cell: "cell"} };
        function CollectUrl(url, obj) {
            var ruleId = 2;
            $.post("/tools/File.ashx?param=collect", {url:url,ruleid:ruleId }, function () {
                alert("OK");
            });

        }
        function buildButton(d,e,f) {
            return "<input type='button' value='采集' onclick=\"return CollectUrl('" + d + "',this)\"/>";
        }
        $(function () {
            $("#tbNather").jqGrid({
                colNames: ["标题", "链接地址", "采集"],
                colModel: [
                    { name: "Title", width: 300 },
                    { name: "Link", width: 400 }, { name: "Link", width: 80, formatter: buildButton }
                ],
                url: "/tools/JSON.ashx?param=ctrl&type=jqgrid&act=getrsslist&rsslink=0",
                jsonReader: jgGridjsonReader,
                datatype: 'json',
                height: 450
            });
            $("#btnCollectRss").click(function () {
                var url = $("#txtUrl").val();
                var jqUrl = "/tools/JSON.ashx?param=ctrl&type=jqgrid&act=getrsslist&rsslink=" + escape(url);
                $("#tbNather").setGridParam({ url: jqUrl }).trigger("reloadGrid");
                return false;
            });
        });
    </script>
    <style type="text/css" >
    #txtUrl{ width:300px;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <label for="txtUrl">RSS地址</label>
    <input type="text" value="http://www.51cto.com/php/rss.php?typeid=2" id="txtUrl" />
    
    <input id="btnCollectRss" type="button" value="采集" />

    </div>
    <div>
        <table id="tbNather">
        </table>
    </div>
    </form>
</body>
</html>
